﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;

namespace nanoCMS.Core {
	public class CoreInstall
	{
		//TODO: register module core
		private readonly WorldContext worldContext;

		public CoreInstall(WorldContext worldContext)
		{
			this.worldContext = worldContext;
			CreateSettings();
		}

		public void RegisterModule()
		{
			worldContext.ModuleProvider.RegisterModule(Settings.ModuleName, "Core");
		}

		public void RegisterActions() {
			//worldContext.ModuleProvider.EditRolesForAction(
			//    worldContext.ModuleProvider.RegisterModuleAction(Settings.ModuleName, "AddBlogPost"),
			//    new[] { "Administrator", "Moderator", "Editor" });

			//worldContext.ModuleProvider.EditRolesForAction(
			//    worldContext.ModuleProvider.RegisterModuleAction(Settings.ModuleName, "EditBlogPost"),
			//    new[] { "Administrator", "Moderator", "Editor" });

			//worldContext.ModuleProvider.EditRolesForAction(
			//    worldContext.ModuleProvider.RegisterModuleAction(Settings.ModuleName, "AddBlogCategory"),
			//    new[] { "Administrator", "Moderator" });
		}

		public void CreateSettings()
		{
			//Membership
			ConfigurationManager.AppSettings.Add("RootUserID", "1");
			ConfigurationManager.AppSettings.Add("RegistrationsOpen", "true");
			ConfigurationManager.AppSettings.Add("MailAuthorisation", "true");
		}
	
	}

	
}
